package timing.ukulele.project.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import timing.ukulele.persistent.service.BaseService;
import timing.ukulele.project.mapper.BusinessDataMapper;
import timing.ukulele.project.persistent.BusinessData;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BusinessDataService extends BaseService<BusinessDataMapper, BusinessData> {

    public List<BusinessData> getHistoryBusinessData(String businessCode) {
        LambdaQueryWrapper<BusinessData> qw = new LambdaQueryWrapper<>();
        qw.eq(BusinessData::getBusinessCode, businessCode);
        qw.orderByAsc(BusinessData::getId);
        List<BusinessData> businessDataList = getBaseMapper().selectList(qw);
        return businessDataList;
    }

    public List<BusinessData> getHistoryBusinessDataById(Long businessId) {
        LambdaQueryWrapper<BusinessData> qw = new LambdaQueryWrapper<>();
        qw.eq(BusinessData::getBusinessId, businessId);
        qw.orderByAsc(BusinessData::getId);
        List<BusinessData> businessDataList = getBaseMapper().selectList(qw);
        return businessDataList;
    }
}
